package com.bckj.freshnow.order.mapper;

import com.bckj.freshnow.order.entity.TradeOrder;
import com.bckj.freshnow.order.model.TradeOrderResponse;
import com.bckj.freshnow.order.model.TradeOrderRequest;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.jdbc.SQL;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;

/**
 * 交易订单表(TradeOrder)表数据库访问层
 *
 * @author makejava
 * @since 2025-04-22 10:19:34
 */
@Mapper
public interface TradeOrderMapper extends BaseMapper<TradeOrder> {

    /**
      * 列表
      *
      * @param request req
      * @return list
      */
    @SelectProvider(method = "findAll" , type = TradeOrderProvider.class)
    List<TradeOrderResponse> findAll(TradeOrderRequest request);
    
    class TradeOrderProvider{
        
        public String findAll(TradeOrderRequest request){
            SQL sql = new SQL();
            sql.SELECT("id, user_id, shop_id, merchant_id, order_no, parent_order_no, out_order_no, order_source, order_type, order_status, pay_status, after_sale_status, verification_status, total_amount, pay_amount, discount_amount, freight_amount, pay_time, verification_time, finish_time, user_remark, merchant_remark, platform_remark, is_deleted, version, update_time, create_time");
            sql.FROM("trade_order");
            return sql.toString();
        }
    }
}

